package com.demo.test.observe.abs;

import java.util.ArrayList;
import java.util.List;

public abstract class Subject {
    private List<Observe> observeList = new ArrayList<>();

    public  void attach(Observe observe){
        this.observeList.add(observe);
    };
    public void detach(Observe observe){
        this.observeList.remove(observe);
    };

    public void allNotify(){
        for(Observe observe:observeList){
            observe.update();
        }
    }

}
